package com.xiaode.controller.app.chat;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.ext.cors.EnableCORS;
import com.jfinal.kit.Ret;
import com.xiaode.common.anotation.JSONArrayString;
import com.xiaode.util.apidoc.annotation.Api;
import com.xiaode.util.apidoc.annotation.ApiOper;
import com.xiaode.util.apidoc.annotation.ApiPara;


@Path("/mailList")
@Api("通讯录")
@EnableCORS
public class MailListController extends Controller {
	
	@Inject
    MailListService service;

    @ApiOper("通讯录")
    public void findMailList()throws Exception{
        Ret ret = service.findMailList();
        renderJson(ret);
    }

    @ApiOper("我的群组")
    public void myChatGroup()throws Exception{
    	Integer accountId = getAttr("accountId");
        Ret ret = service.myChatGroup(accountId);
        renderJson(ret);
    }

    @ApiOper("添加星标联系人")
    public void addStarFriends(@JSONArrayString @ApiPara(value = "accountIds",notes = "星标联系人账号ids")String accountIds)throws Exception{
    	Integer accountIdMy = getAttr("accountId");
        Ret ret = service.addStarFriends(accountIdMy, accountIds);
        renderJson(ret);
    }

    @ApiOper("删除星标联系人")
    public void delStarFriends(@JSONArrayString @ApiPara(value = "stuIds",notes = "星标联系人账号ids")String accountIds)throws Exception{
    	Integer accountIdMy = getAttr("accountId");
        Ret ret = service.delStarFriends(accountIdMy, accountIds);
        renderJson(ret);
    }

    @ApiOper("查询星标联系人")
    public void findStarFriends()throws Exception{
    	Integer accountIdMy = getAttr("accountId");
        Ret ret = service.findStarFriends(accountIdMy);
        renderJson(ret);
    }


}
